<?php
$this->breadcrumbs=array(
	'獎品管理'=>array('admin'),
	'列表',
);

$this->menu=array(
	array('label'=>'新增獎品', 'url'=>array('create')),
	array('label'=>'獎品列表', 'url'=>array('admin')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('prize-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'prize-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'prizeid' => array(
			'name' => 'prizeid',
			'headerHtmlOptions' => array('width' => '10%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'prizename' => array(
			'name' => 'prizename',
			'headerHtmlOptions' => array('width' => '50%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),		
		'status' => array(
			'name' => 'status',
			'headerHtmlOptions' => array('width' => '10%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'hot' => array(
			'name' => 'hot',
			'headerHtmlOptions' => array('width' => '10%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		array(
            'class' => 'CButtonColumn',
            'header' => '操作',
            'template' => '{view}{edit}{soldout}',
			'buttons' => array(
                'view' => array(
                    'label' => '瀏覽',
                    'imageUrl' => Yii::app()->baseUrl . '/images/zoomin.png',
                    'url' => 'Yii::app()->controller->createUrl("prize/view",array("id"=>$data->prizeid))',
                ),
                'edit' => array(
                    'label' => '修改',
                    'imageUrl' => Yii::app()->baseUrl . '/images/edit.png',
                    'url' => 'Yii::app()->controller->createUrl("prize/update",array("id"=>$data->prizeid))',
                ),
                'soldout' => array(
                    'label' => '上/下架',
                    'imageUrl' => Yii::app()->baseUrl . '/images/up.png',
                    'url' => 'Yii::app()->controller->createUrl("prize/soldout",array("id"=>$data->prizeid))',
                ),
            ),    
        ),
	),
)); ?>
